package codetop;

import java.util.*;

public class lc645 {
    public static void main(String[] args) {
//        findErrorNums(new int[]{1,5,3,2,2,7,6,4,8,9});
        missingTwo(new int[]{1});
    }
    public static int[] findErrorNums(int[] nums) {
        Arrays.sort(nums);
        int n = nums.length;
        int[] flag = new int[n];
        int[] ans = new int[2];
        for(int i = 0; i < nums.length - 1; i++){
            if(nums[i] == nums[i + 1]){
                ans[0] = nums[i];
            }
            flag[nums[i] - 1] = 1;
        }
        flag[nums[n - 1] - 1] = 1;
        for(int i = 0; i < n; i++){
            if(flag[i] == 0){
                ans[1] = i + 1;
                break;
            }
        }
        System.out.println(ans[0] + " " + ans[1]);
        return ans;
    }

    public static int[] missingTwo(int[] nums) {
        int n = nums.length + 2;
        int[] map = new int[n];
        for (int i = 0; i < nums.length; i++) {
            map[nums[i] - 1]++;
        }
        int[] re = new int[2];
        int t = 0;
        for (int i = 0; i < n; i++) {
            if(map[i] == 0){
                re[t++] = i + 1;
            }
        }
        System.out.println(re[0] + " " + re[1]);
        return re;
    }
}
